from alg import maximumCostSubstring
from gen import generate_data

def test():
    # 随机测试多组数据
    for _ in range(5):
        s, chars, vals = generate_data()
        print(f"s: {s}\nchars: {chars}\nvals: {vals}")
        res = maximumCostSubstring(s, chars, vals)
        print(f"最大开销: {res}\n{'-'*30}")
    # 边界测试
    print("边界测试:")
    print(maximumCostSubstring("", "a", [1]))  # 0
    print(maximumCostSubstring("a", "a", [-10]))  # 0
    print(maximumCostSubstring("abc", "b", [-2]))  # 4

if __name__ == "__main__":
    test()
